﻿using Microsoft.AspNetCore.Mvc;
using BlazorShop.Models;
using BlazorShop.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query.Internal;

namespace BlazorShop.Controllers
{
    public class AdminController : Controller
    {
        private readonly BlazorShopContext _context;

        public AdminController(BlazorShopContext context)
        {
            _context = context;
        }
        //public Task<IActionResult> Index()
        //{
        //    return View();
        //}

        public async Task<IActionResult> ProductLIst()
        {
            var eshop = _context.Product;
            List<Product> products = await _context.Product.ToListAsync();
            return View(products.OrderByDescending(m => m.ProductId));

        }
    }
}
